﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Ace;
using Ace.Application.Common;
using Ace.Application.Wiki;
using Ace.Entity.Wiki;
using Ace.IdStrategy;
using Ace.Web.Mvc;
using Ace.Web.Mvc.Authorization;
using Ace.Web.Mvc.Models;
using Chloe.Admin.Common;
using Chloe.Admin.Common.Tree;
using Microsoft.AspNetCore.Mvc;

namespace Chloe.Admin.Areas.Wiki.Controllers
{

    [Area(AreaNames.Wiki)]
    [Permission("wiki.userschargeitem")]
    public class UsersChargeItemController : WebController<IUsersChargeItemService>
    {
        public IActionResult Index()
        {
            

            return View();
        }

        public ActionResult Models(Pagination pagination, string keyword="")
        { 
            PagedData<UsersChargeItem> pagedData = this.Service.GetPageData(pagination, keyword);
            return this.SuccessData(pagedData);
        }


        [Permission("wiki.userschargeitem.delete")]
        [HttpPost]
        public ActionResult Delete(string id)
        { 
            this.Service.Delete(id);
            return this.SuccessMsg("删除成功");
        }
         
 


        [Permission("wiki.userschargeitem.edit")]
        [HttpPost]
        public ActionResult Edit(UpdateUsersChargeItemInput modle)
        {           
            this.Service.Update(modle);
            return this.SuccessMsg("编辑成功");
        }

        [Permission("wiki.userschargeitem.add")]
        [HttpPost]
        public ActionResult Add(AddUsersChargeItemInput modle)
        { 
            this.Service.Add(modle);
            return this.SuccessMsg("添加成功");
        }


        public ActionResult GetModelByMobile(string Mobile)
        {
            Users users = this.CreateService<IUsersService>().GetModelByMobile(Mobile);
            if(users!=null)
            {
                return this.SuccessData(users);
            }
            else
            {
                return this.FailedMsg("没有查询到用户信息");
            }
        }

    }
}